package com.example.testanimation.truditionnal;

import android.app.Activity;
import android.content.Context;
import android.os.Bundle;
import android.util.AttributeSet;
import android.view.Menu;
import android.view.View;
import android.view.animation.Animation;
import android.view.animation.CycleInterpolator;
import android.view.animation.TranslateAnimation;
import android.widget.SeekBar;
import android.widget.Toast;
import android.widget.SeekBar.OnSeekBarChangeListener;
import com.example.testanimation.widget.CustomEditText;
import com.scenic.rd_android.R;

public class Animation_Normal_MainActivity extends Activity {

	private CustomEditText editText;
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.activity_main);
		
		editText = (CustomEditText) findViewById(R.id.id_edtxt_main);
		
	}

	



	int index;
	public void goAnimation(View view){
		index++;
		System.out.println("ddddddd");
		Animation animation = new TranslateAnimation(0, 500, 0, 0);
		animation.setDuration(1000);

		animation.setInterpolator(new MyInterploator(index));
		editText.startAnimation(animation);
		
		Toast.makeText(this, "index is " + index, Toast.LENGTH_LONG).show();
	}
	
	class MyInterploator extends CycleInterpolator {

		public MyInterploator(Context context, AttributeSet attrs) {
			super(context, attrs);
		}

		public MyInterploator(float cycles) {
			super(cycles);
		}
		@Override
		public float getInterpolation(float input) {
			float dd = (float)(Math.sin(2 * index * Math.PI * input));
			System.out.println(dd);
			return dd;
		}
		
		
	}
	
}
